<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<script>
	var ctx = "${ctx}";
</script>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>我的红包列表管理</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT">

<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}"
	rel="stylesheet" />
<link
	href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}"
	rel="stylesheet" />
<link href="${ctx}/static/css/animate.min.css?v=${static_version}"
	rel="stylesheet" />
<link href="${ctx}/static/css/style.min.css?v=${static_version}"
	rel="stylesheet" />
<link href="${ctx}/static/css/common.css?v=${static_version}"
	rel="stylesheet" />
<link href="//at.alicdn.com/t/font_9x03jhokyws9vn29.css"
	rel="stylesheet" />
<!-- Data Tables -->
<link
	href="${ctx}/static/css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">

</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content  animated fadeInRight">
		<div class="ibox float-e-margins">

			<!-- 我的红包列表 -->
			<div class="ibox-title">
				<h5>
					我的红包广告列表<small></small>
				</h5>
			</div>

			<div class="ibox-content">
<!-- 
				<div class="row">
					<form class="form-group" id="packets_table_form">
						<input type="hidden" name="orderBy" value="create_date desc">
						<input type="hidden" id="packets-select-id" name="packets-select"
							value="">


						<div class="col-md-2">
							<input name="keyword" type="text" placeholder="请输入关键字"
								class="form-control" />
						</div>
						<div class="col-md-4">
							<div class="input-daterange input-group">
								<input id="startTime" type="text"
									class="input-md form-control layer-date" placeholder="开始时间"
									name="startTime"> <span class="input-group-addon">至</span>
								<input id="endTime" type="text"
									class="input-md form-control layer-date" placeholder="结束时间"
									name="endTime">
							</div>
						</div>
						<div class="col-md-2 col-sm-2">
							<select data-placeholder="选择红包" id="packets-select-select"
								class="input-md form-control chosen-select" tabindex="4">
								<option value="">选所红包</option>
							</select>
						</div>
						<div class="col-md-1 col-sm-2">
							<button id="packets_table_search" type="button"
								class="btn btn-primary">查询</button>
						</div>

						<div class="col-md-1  col-sm-2 pull-right ">
							<a onclick="clickInsertGet()" class="btn btn-primary">添加</a>
						</div>
					</form>
				</div>
				<div class="hr-line-dashed3"></div> -->

				<table id="packets_table" data-action="${ctx}/packets/find"
					class="table table-striped table-bordered table-hover dataTables-example">
					<thead>
						<tr>
							<th width="40">ID</th>
							<th class="text-center">广告图片</th>
							<th>标题</th>
							<th width="80">红包类型</th>
							<th width="80">总金额</th>
							<th width="120">最大-最小红包金额</th>
							<th width="120">支付状态</th>
							<th class="text-center">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${bonuslist}" var="u_bonus">
							<tr class="gradeC">
								<input type="hidden" id="id" name="id" value='${u_bonus.id}' />
								<td>${u_bonus.id}</td>
								<td class="text-center">
									<c:if test="${u_bonus.type==1}">
										<img src="${u_bonus.advert.covers}" height="50" border="0" />
									</c:if> <c:if test="${u_bonus.type==2}">
										<img src="${u_bonus.advert.covers}?vframe/png/offset/3"
											height="50" border="0" />
									</c:if></td>
								<td>${u_bonus.title}</td>
								<td><c:if test="${u_bonus.type==1}">图片</c:if> <c:if
										test="${u_bonus.type==2}">视频</c:if></td>
								<td>${u_bonus.advert.total_amount}</td>
								<td>${u_bonus.max_money}-${u_bonus.min_money}</td>
								<td><c:choose>
										<c:when test="${u_bonus.is_pay == 0}">
										未支付
									</c:when>
										<c:otherwise>
										已支付
									</c:otherwise>
									</c:choose></td>
								<td class="text-center"><c:choose>
										<c:when test="${u_bonus.is_pay==0}">
											<a class="btn btn-warning"
												href="${ctx}/toadvertpay?advertid=${u_bonus.advert.id}"
												title="支付">支付</a> &nbsp;&nbsp;
									</c:when>
									</c:choose> <a class="btn btn-warning"
									onClick="u_bonus_edit(this,'${u_bonus.id}')"
									href="javascript:void(0);" title="编辑">编辑</a>
									&nbsp;&nbsp;&nbsp;&nbsp; <a class="btn btn-danger"
									onClick="u_bonus_delete(this,'${u_bonus.id}')"
									href="javascript:void(0);" title="删除">删除</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<div class="row">
					<div class="col-md-6" class="pull-left" id="page_left_text"></div>
					<div class="col-md-6" id="page_text"></div>
				</div>
			</div>
		</div>

	</div>

	<script src="${ctx}/static/js/jquery.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/bootstrap.min.js?v=${static_version}"></script>
	<script
		src="${ctx}/static/js/plugins/layer/layer.js?v=${static_version}"></script>
	<script
		src="${ctx}/static/js/plugins/dataTables/jquery.dataTables.js?v=${static_version}"></script>
	<script
		src="${ctx}/static/js/plugins/dataTables/dataTables.bootstrap.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/pingpp.js"></script>

	<script>
		$(document).ready(function() {
			$(".dataTables-example").dataTable();
		});

		/*编辑*/
		function u_bonus_edit(obj, id) {
			var index = layer.open({
				type : 2,
				title : '红包广告编辑',
				shadeClose : true,
				shade : 0.8,
				content : "${ctx}/advert_bonusadvert-addOrUpdate?id=" + id
			});
			layer.full(index);
		}

		/*软删除*/
		function u_bonus_delete(obj, id) {
			layer.confirm('确认删除？', {
				btn : [ '确认', '取消' ],
				shade : false
			}, function() {
				$.ajax({
					type : "POST",
					url : "${ctx}/bonus-delete",
					data : "bonusid=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {
							icon : 6,
							time : 1000
						});
						location.reload();
					}
				});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}
	</script>
</body>
</html>